#!/bin/sh
set -e

. /usr/share/debconf/confmodule

warn_about_remaining_xorg_configuration()
{
	# allow to disable the check via preseeding
	db_get nvidia-support/check-xorg-conf-on-removal || true
	test "$RET" = "true" || return 0

	XORG_CONF=$(grep -l '^[^#]*nvidia' /etc/X11/xorg.conf /etc/X11/xorg.conf.d/*.conf 2>/dev/null || true)

	test -n "$XORG_CONF" || return 0

	db_subst nvidia-support/removed-but-enabled-in-xorg-conf config-files "$XORG_CONF"
	db_fset nvidia-support/removed-but-enabled-in-xorg-conf seen false
	db_input high nvidia-support/removed-but-enabled-in-xorg-conf || true
	db_go

}

if [ "$1" = "remove" ]; then

	warn_about_remaining_xorg_configuration

fi

#DEBHELPER#
